import React, { Component } from 'react'
import ThemeContext from './context/theme-context'
import UserContext from './context/user-context'

export class UserInfo extends Component {
  render() {
    // console.log(this.context)
    return (
      <div>
        <p>UserInfo</p>
        {/* 继续使用多个Context共享的数据 */}
        <UserContext.Consumer>
          {
            value => {
              return <h3>{ value.name } - { value.age } - { value.avatar }</h3>
            }
          }
        </UserContext.Consumer>
        {/* 还可以有更多的context共享的数据 */}
      </div>
    )
  }
}

UserInfo.contextType = ThemeContext

export default UserInfo